<template>
  <el-space direction="vertical">

    <el-card class="box-card" v-for="o in classList" @click="subCmdList(o.cmd)">
      <template #header>
        <div class="card-header">
          <span>{{ o.cmd }} - {{ o.comment }}</span>
        </div>
      </template>
      <div class="text item">{{ o.actionSimpleName }}</div>
      <ActionMethodList v-slot:a></ActionMethodList>
    </el-card>

  </el-space>
</template>

<script>
import {reactive} from "vue";
import ActionMethodList from "@/components/ActionMethodList.vue";

export default {
  name: "ActionControllerList",
  components: {ActionMethodList},
  setup(props, context) {
    // 读取 cmd数据
    let classList = reactive([{
      cmd: 1,
      actionSimpleName: 'DemoAction',
      comment: '示例'
    }, {
      cmd: 2,
      actionSimpleName: 'FightAction',
      comment: '示例 fight'
    }])

    function subCmdList(cmd) {
      console.info("subCmdList", cmd)

    }

    return {
      classList,
      subCmdList
    }
  }
}

</script>

<style scoped>
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.el-card {
  --el-card-padding: 10px;
}
.text {
  font-size: 16px;
}

.box-card {
  width: 240px;
}
</style>